package com.sunflower.bath.common.factory;

import com.sunflower.bath.common.contants.BathContants;
import com.sunflower.bath.common.interf.IJob;
import com.sunflower.bath.common.interf.impl.JarJob;
import com.sunflower.bath.common.interf.impl.MysqlJob;
import com.sunflower.bath.common.interf.impl.ProcedureJob;
import com.sunflower.bath.common.interf.impl.UrlJob;
import com.sunflower.bath.model.JobNeedExecut;

public class JobFactory {
	
    public static IJob getInstance(JobNeedExecut jobN) {  
    	IJob job = null;
    	switch (jobN.getJobType()) {
    	//sql类批处理
		case BathContants.JOB_TYPE_0:
			//mysql
			if(jobN.getServerType()==BathContants.SERVWE_DB_TYPE_0){
				job = new MysqlJob();
			}
			break;
			
		//jar包类批处理
		case BathContants.JOB_TYPE_1:
			job = new JarJob();
			break;
			
		//url类批处理
		case BathContants.JOB_TYPE_2:
			job = new UrlJob();		
			break;
			
		//存储过程类批处理
		case BathContants.JOB_TYPE_3:
			job = new ProcedureJob();
			break;
		default:
			break;
		}
        return job;  
    }  
}
